package ynu.edu.order.client;

import org.springframework.stereotype.Component;
import ynu.edu.common.result.Result;
import ynu.edu.order.vo.DishSpecVO;
import ynu.edu.order.vo.DishVO;

import java.math.BigDecimal;

/**
 * 菜品服务Feign客户端降级处理
 */
@Component
public class DishClientFallback implements DishClient {

    @Override
    public Result<DishVO> getDishById(Long id) {
        DishVO dishVO = new DishVO();
        dishVO.setId(id);
        dishVO.setName("未知菜品");
        dishVO.setPrice(new BigDecimal("0.00"));
        return Result.success(dishVO);
    }

    @Override
    public Result<DishSpecVO> getDishSpecById(Long id) {
        DishSpecVO dishSpecVO = new DishSpecVO();
        dishSpecVO.setId(id);
        dishSpecVO.setName("未知规格");
        dishSpecVO.setPrice(new BigDecimal("0.00"));
        return Result.success(dishSpecVO);
    }
} 